﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
typedef struct fushu
{
		double a;
		double b;
}FUSHU;

//请编写2个函数：1两个复数的和；2两个复数的积
FUSHU addition(FUSHU c1, FUSHU c2) {
	FUSHU new;
	new.a = c1.a + c2.a;
	new.b = c1.b + c2.b;
	return new;
}

FUSHU product(FUSHU c1, FUSHU  c2) {
	FUSHU new;
	new.a = c1.a * c2.a - c1.b * c2.b;
	new.b = c1.a * c2.b + c2.a * c1.b;
	return new;
}

int main1()
{
	FUSHU c1, c2, sum, c;
	//读入两个复数c1  c2
	scanf("%lf%lf%lf%lf", &c1.a, &c1.b, &c2.a, &c2.b);
	sum= addition(c1, c2);
	c = product(c1, c2);
	//输出复数c1  c2的和、积
	printf("addition of complex is %lf+%lfi\n", sum.a, sum.b);
	printf("product of complex is %lf+%lfi", c.a, c.b);
	return 0;
}




#include<stdio.h>
#include<math.h>
#include<stdbool.h>
typedef double Tdata;
typedef struct Triangle {
	Tdata a;
	Tdata b;
	Tdata c;
}Triangle;
//输入三条边
Triangle inputTriangle() {
	Triangle new;
	scanf("%lf%lf%lf", &new.a, &new.b, &new.c);
	return new;
}
//判断是否为三角形，即两边之和是否大于第三边
Tdata isValidTriangle(Triangle t) {
	return t.a + t.b - t.c;
}
//计算该三角形的周长
Tdata calPerimeter(Triangle t) {
	return t.a + t.b + t.c;
}
//用于计算该三角形的面积
Tdata calArea(Triangle t) {
	Tdata p = calPerimeter(t) / 2;
	return sqrt(p * (p - a) * (p - b) * (p - c));
}
//判断该三角形是否为直角三角形
bool isRightTriangle(Triangle t) {
	if (t.a * t.a + t.b * t.b == t.c * t.c
		|| t.a * t.a + t.c * t.c == t.b * t.b
		|| t.b * t.b + t.c * t.c == t.a * t.a)
		return true;
	else
		return false;
}
//判断该三角形是否为等腰三角形
bool isIsoscelesTriangle(Triangle t) {
	if (t.a == t.b
		|| t.a == t.c
		|| t.b == t.c)
		return true;
	else
		return false;
}
//判断该三角形是否为等边三角形
bool isEquilateralTriangle(Triangle t) {
	if (t.a == t.b == t.c)
		return true;
	else
		return false;
}


int  main()
{
	Triangle  t = inputTriangle();

	if (isValidTriangle(t))
	{
		printf("Valid  triangle!\n");
		printf("Area:  %.2lf\n", calArea(t));
		printf("Perimeter:  %.2lf\n", calPerimeter(t));

		if (isRightTriangle(t))
			printf("Right  triangle!\n");//直角三角形

		if (isIsoscelesTriangle(t))
			printf("Isosceles  triangle!\n");//等边三角形
		else  if (isEquilateralTriangle(t))
			printf("Equilateral  triangle!\n");//等腰三角形
	}
	else
		printf("Invalid  triangle!\n");

	return  0;
}